package com.stdspringboot.util;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;

public class JWTUtil {

	
	public static <T> T parse(String auth,Class<T> clazz) throws JsonParseException, JsonMappingException, IOException{
		JWT jwt=new JWT();
		String authText=jwt.verifyToken(auth);
		ObjectMapper om=new ObjectMapper();
		T ret=om.readValue(authText, clazz);
		return ret;
	}
}
